﻿@using VietTrips.WebUI.Helpers

@model VietTrips.WebUI.Areas.Management.Models.CreateActivityModel

@{
    NavCurrentHelper.Menu = 7;                                                  // Store the navigation side bar state
    NavCurrentHelper.Submenu = 1;                                               // Store the navigation side bar state
    ViewBag.Title = "Thêm Hoạt Động";
    Layout = "~/Areas/Management/Views/Shared/_AdminLayout.cshtml";
}

@section styles {
    <link rel="stylesheet" type="text/css" href="~/Content/metronic/plugins/bootstrap-fileinput/bootstrap-fileinput.css" />
}

@section featured {
    <!-- BEGIN PAGE HEADER-->
    <div class="row">
        <div class="col-md-12">
            <!-- BEGIN PAGE TITLE & BREADCRUMB-->
            <h3 class="page-title">
                @ViewBag.Title
            </h3>
            <ul class="page-breadcrumb breadcrumb">
                <li>
                    <i class="fa fa-home"></i>
                    <a href="@Url.Action("Dashboard", "Admin")">
                        Trang Quản Lý
                    </a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    Hoạt Động Du Lịch
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    <a href="#">
                        @ViewBag.Title
                    </a>
                </li>
                <li class="pull-right">
                    <div id="dashboard-report-range" class="dashboard-date-range tooltips" data-placement="top" data-original-title="Change dashboard date range">
                        <i class="fa fa-calendar"></i>
                        <span>
                        </span>
                        <i class="fa fa-angle-down"></i>
                    </div>
                </li>
            </ul>
            <!-- END PAGE TITLE & BREADCRUMB-->
        </div>
    </div>
}


<!-- BODY PART -->

<div class="row">
    <div class="col-md-9">
        <div class="row">
            @using (Html.BeginForm("NewActivity", "ActivityManager", new { @class = "horizontal-form" })) {
                <div class="col-md-12">
                    <div class="portlet box white">
                        <div class="portlet-title mt-20">
                            <div class="caption">
                                <i class="fa fa-certificate"></i>Thêm Hoạt Động
                            </div>
                        </div>
                        <div class="portlet-body form">
                            <div class="form-body">
                                @Html.AntiForgeryToken()
                                <div class="row mt-10">
                                    <label class=""></label>
                                    @Html.LabelFor(m => m.ActivityName, htmlAttributes: new { @class = "col-md-3 ml-10 control-label label-required" })
                                    <div class="col-md-8">
                                        @Html.TextBoxFor(m => m.ActivityName, htmlAttributes: new { @class = "form-control", placeholder = "Tên hoạt động.." })
                                        <span class="help-block">
                                            Tên hoạt động rõ ràng giúp việc tìm và chọn hoạt động nhanh hơn.
                                        </span>
                                        <span class="text-error text-danger">
                                            @Html.ValidationMessageFor(m => m.ActivityName)
                                        </span>
                                    </div>
                                </div>
                                <div class="row mt-10">
                                    @Html.LabelFor(m => m.Description, htmlAttributes: new { @class = "col-md-3 ml-10 control-label label-required" })
                                    <div class="col-md-8">
                                        @Html.TextAreaFor(m => m.Description, htmlAttributes: new { @class = "form-control", placeholder = "Mô tả chi tiết hoạt động..", rows = "5" })
                                        <span class="help-block">
                                            Phần mô tả này sẽ có trong bảng mô tả Tour và Chuyến Đi gửi cho khách.
                                        </span>
                                        <span class="text-error text-danger">
                                            @Html.ValidationMessageFor(m => m.Description)
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-actions nobg bottom right">
                                <button type="submit" class="btn btn-lg btn-primary"><i class="fa fa-plus"> </i> Thêm hoạt động mới</button>
                            </div>
                        </div>
                    </div>
                </div>
                            <div class="col-md-12">
                                <div class="portlet box white">
                                    <div class="portlet-title">
                                        <div class="caption">
                                            <i class="fa fa-reorder"></i>Chọn Địa Điểm
                                        </div>
                                        <div class="tools">
                                            <a href="javascript:;" class="collapse">
                                            </a>
                                        </div>
                                    </div>
                                    <div class="portlet-body" style="display: block;">
                                        <ul class="nav nav-tabs">
                                            <li class="active">
                                                <a href="#tab_1_1" data-toggle="tab">
                                                    Tạo Mới
                                                </a>
                                            </li>
                                            <li class="">
                                                <a href="#tab_1_2" data-toggle="tab">
                                                    Danh Sách Địa Điểm
                                                </a>
                                            </li>
                                        </ul>
                                        <div class="tab-content">

                                            <div class="tab-pane active" id="tab_1_1">
                                                <!-- SELECT PLACE -->
                                                <div class="form-body">
                                                    @Html.AntiForgeryToken()
                                                    <div class="row mt-10">
                                                        @Html.LabelFor(m => m.PlaceName, htmlAttributes: new { @class = "col-md-3 ml-10 control-label" })
                                                        <div class="col-md-8">
                                                            @Html.TextBoxFor(m => m.PlaceName, htmlAttributes: new { @class = "form-control", placeholder = "Tên Địa điểm.." })
                                                            <span class="help-block">
                                                                Tên địa điểm du lịch, nơi diễn ra hoạt động.
                                                            </span>
                                                            <span class="text-error text-danger">
                                                                @Html.ValidationMessageFor(m => m.PlaceName)
                                                            </span>
                                                        </div>
                                                    </div>
                                                    <div class="row mt-10">
                                                        @Html.LabelFor(m => m.PlaceDescription, htmlAttributes: new { @class = "col-md-3 ml-10 control-label" })
                                                        <div class="col-md-8">
                                                            @Html.TextAreaFor(m => m.PlaceDescription, htmlAttributes: new { @class = "form-control", placeholder = "Mô tả sơ lượt về địa điểm..", rows = "2" })
                                                            <span class="text-error text-danger">
                                                                @Html.ValidationMessageFor(m => m.PlaceDescription)
                                                            </span>
                                                        </div>
                                                    </div>
                                                    <div class="row mt-10">
                                                        @Html.LabelFor(m => m.PlaceAddress, htmlAttributes: new { @class = "col-md-3 ml-10 control-label" })
                                                        <div class="col-md-8">
                                                            @Html.TextAreaFor(m => m.PlaceAddress, htmlAttributes: new { @class = "form-control", placeholder = "Địa chỉ của địa điểm..", rows = "2" })
                                                            <span class="text-error text-danger">
                                                                @Html.ValidationMessageFor(m => m.PlaceAddress)
                                                            </span>
                                                        </div>
                                                    </div>
                                                    <div class="row mt-10">
                                                        @Html.LabelFor(m => m.PlaceCity, htmlAttributes: new { @class = "col-md-3 ml-10 control-label" })
                                                        <div class="col-md-8">
                                                            <form class="form-inline margin-bottom-10" action="#">
                                                                <div class="input-group">
                                                                    @Html.TextBoxFor(m => m.PlaceCity, htmlAttributes: new { @class = "form-control", placeholder = "Tỉnh / Thành Phố.." })
                                                                    <span class="input-group-btn">
                                                                        <button class="btn blue" id="gmap_geocoding_btn"><i class="fa fa-search"></i></button>
                                                                    </span>
                                                                </div>
                                                            </form>
                                                            <span class="text-error text-danger">
                                                                @Html.ValidationMessageFor(m => m.PlaceCity)
                                                            </span>
                                                        </div>
                                                    </div>
                                                    <div class="row mt-10">
                                                        <div class="col-md-3 ml-10"></div>
                                                        <div class="col-md-8">
                                                            <div id="gmap_geocoding" class="gmaps">
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="form-actions nobg bottom right">
                                                    <button type="submit" class="btn btn-lg btn-primary"><i class="fa fa-plus"> </i> Thêm hoạt động mới</button>
                                                </div>
                                            </div>
                                            <div id="tab_1_2" class="tab-pane fade">
                                                <div class="row search-form-default">
                                                    <div class="col-md-12">
                                                        <form class="form-inline" action="#">
                                                            <div class="input-group">
                                                                <div class="input-cont">
                                                                    <input type="text" placeholder="Search..." class="form-control">
                                                                </div>
                                                                <span class="input-group-btn">
                                                                    <button type="button" class="btn green">
                                                                        Search &nbsp; <i class="m-icon-swapright m-icon-white"></i>
                                                                    </button>
                                                                </span>
                                                            </div>
                                                        </form>
                                                    </div>
                                                </div>
                                                <div class="table-responsive mt-10">
                                                    <table class="table table-striped table-advance table-hover">
                                                        <thead>
                                                            <tr>
                                                                <th>
                                                                    Photo
                                                                </th>
                                                                <th>
                                                                    Fullname
                                                                </th>
                                                                <th>
                                                                    Username
                                                                </th>
                                                                <th>
                                                                    Joined
                                                                </th>
                                                                <th>
                                                                    Points
                                                                </th>
                                                                <th>
                                                                    Status
                                                                </th>
                                                                <th>
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td>
                                                                    <img src="~/Content/metronic/img/avatar1.jpg" alt="">
                                                                </td>
                                                                <td>
                                                                    Mark Nilson
                                                                </td>
                                                                <td>
                                                                    makr124
                                                                </td>
                                                                <td>
                                                                    19 Jan 2012
                                                                </td>
                                                                <td>
                                                                    1245
                                                                </td>
                                                                <td>
                                                                    <span class="label label-sm label-success">
                                                                        Approved
                                                                    </span>
                                                                </td>
                                                                <td>
                                                                    <a class="btn default btn-xs red-stripe" href="#">
                                                                        Xem Bản Đồ
                                                                    </a>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    <img src="~/Content/metronic/img/avatar2.jpg" alt="">
                                                                </td>
                                                                <td>
                                                                    Filip Rolton
                                                                </td>
                                                                <td>
                                                                    jac123
                                                                </td>
                                                                <td>
                                                                    09 Feb 2012
                                                                </td>
                                                                <td>
                                                                    15
                                                                </td>
                                                                <td>
                                                                    <span class="label label-sm label-info">
                                                                        Pending
                                                                    </span>
                                                                </td>
                                                                <td>
                                                                    <a class="btn default btn-xs blue-stripe" href="#">
                                                                        Xem Bản Đồ
                                                                    </a>
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                </div>
                                                <div class="margin-top-20">
                                                    <ul class="pagination">
                                                        <li>
                                                            <a href="#">
                                                                Prev
                                                            </a>
                                                        </li>
                                                        <li>
                                                            <a href="#">
                                                                1
                                                            </a>
                                                        </li>
                                                        <li>
                                                            <a href="#">
                                                                2
                                                            </a>
                                                        </li>
                                                        <li class="active">
                                                            <a href="#">
                                                                3
                                                            </a>
                                                        </li>
                                                        <li>
                                                            <a href="#">
                                                                4
                                                            </a>
                                                        </li>
                                                        <li>
                                                            <a href="#">
                                                                5
                                                            </a>
                                                        </li>
                                                        <li>
                                                            <a href="#">
                                                                Next
                                                            </a>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </div>
                                        </div>


                                    </div>
                                </div>
                            </div>
              }
        </div>
    </div>
    <div class="col-md-3">
        <div class="row">
            <div class="col-md-12 mt-20">
                <div class="portlet box white">
                    <div class="portlet-title">
                        <div class="caption">
                            <i class="fa fa-reorder"></i>Phân loại hoạt động
                        </div>
                        <div class="tools">
                            <a href="javascript:;" class="collapse">
                            </a>
                        </div>
                    </div>
                    <div class="portlet-body" style="display: block;">
                        <div class="form-body">
                            <div class="form-group">
                                <label class="control-label">
                                    Nhóm hoạt động:
                                </label>
                                <div class="form-control height-auto">
                                    <div class="slimScrollDiv" style="position: relative; overflow: hidden; width: auto; height: 150px">
                                        <div class="scroller" style="height: 150px; overflow: hidden; width: auto;" data-always-visible="1">
                                            <ul class="list-unstyled">
                                                @*<li>
                                                    <label>
                                                        <div class="checker"><span><input type="checkbox" name="product[categories][]" value="1"></span></div>Thể loại 1
                                                    </label>
                                                </li>*@
                                                <li>
                                                    <label>
                                                        <span><input type="checkbox" name="product[categories][]" value="1"></span> Thể loại 1
                                                    </label>
                                                </li>
                                                <li>
                                                    <label>
                                                        <span><input type="checkbox" name="product[categories][]" value="1"></span> Thể loại 2
                                                    </label>
                                                </li>
                                                <li>
                                                    <label>
                                                        <span><input type="checkbox" name="product[categories][]" value="1"></span> Thể loại 3
                                                    </label>
                                                </li>
                                            </ul>
                                        </div><div class="slimScrollBar" style="width: 7px; position: absolute; top: 0px; opacity: 0.4; display: block; border-top-left-radius: 7px; border-top-right-radius: 7px; border-bottom-right-radius: 7px; border-bottom-left-radius: 7px; z-index: 99; right: 1px; height: 196.42857142857144px; background: rgb(187, 187, 187);"></div><div class="slimScrollRail" style="width: 7px; height: 100%; position: absolute; top: 0px; display: none; border-top-left-radius: 7px; border-top-right-radius: 7px; border-bottom-right-radius: 7px; border-bottom-left-radius: 7px; opacity: 0.2; z-index: 90; right: 1px; background: rgb(234, 234, 234);"></div>
                                    </div>
                                </div>
                                <span class="help-block">
                                    chọn thể loại để hỗ trợ tìm kiếm
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-12">
                <div class="portlet box white">
                    <div class="portlet-title">
                        <div class="caption">
                            <i class="fa fa-reorder"></i>Ảnh Đại Diện
                        </div>
                        <div class="tools">
                            <a href="javascript:;" class="collapse">
                            </a>
                        </div>
                    </div>
                    <div class="portlet-body" style="display: block;">
                        <div class="form-body">
                            <div class="row last">
                                <div class="col-md-12">
                                    <div class="fileinput fileinput-new" data-provides="fileinput">
                                        <div class="fileinput-new thumbnail" style="width: 240px; height: 150px;">
                                            <img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&amp;text=no+image" alt="" />
                                        </div>
                                        <div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 240px; max-height: 150px;">
                                        </div>
                                        <div>
                                            <span class="btn default btn-file">
                                                <span class="fileinput-new">
                                                    Chọn ảnh
                                                </span>
                                                <span class="fileinput-exists">
                                                    Thay Đổi
                                                </span>
                                                <input type="file" name="...">
                                            </span>
                                            <a href="#" class="btn default fileinput-exists" data-dismiss="fileinput">
                                                Xoá ảnh
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        </div>
    </div>

    


<!--- END BODY PART -->
@section scripts {
    <script type="text/javascript" src="~/Content/metronic/plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
    <script src="http://maps.google.com/maps/api/js?sensor=true" type="text/javascript"></script>
    @*<script src="~/Content/metronic/plugins/gmaps/gmaps.min.js" type="text/javascript"></script>*@
    <script src="~/Scripts/gmap3.min.js"></script>
    <script>

        var MapsGoogle = function () {
            var mapGeocoding = function () {

                var map = $("#gmap_geocoding").gmap3({
                    map: {
                        address: "Công Viên Phần Mềm Quan Trung, Quận 12, TP HCM",
                        options: {
                            zoom: 15,
                            mapTypeId: google.maps.MapTypeId.MAP,
                            mapTypeControl: false,
                            navigationControl: true,
                            scrollwheel: true
                        }
                    }
                });
                var handleAction = function () {
                    var text = $.trim($('#PlaceAddress').val()) + ", " + $.trim($('#PlaceCity').val());
                    $('#gmap_geocoding').gmap3({
                        clear: {
                            name: ["marker"],
                            last: true
                        }
                    });
                    $("#gmap_geocoding").gmap3({
                        getlatlng: {
                            address: text,
                            callback: function (results) {
                                if (!results) return;
                                $(this).gmap3({
                                    marker: {
                                        name: "marker",
                                        latLng: results[0].geometry.location,
                                        tag: "${i}",
                                        full: true,
                                        options: {
                                            draggable: true
                                        },
                                        animation: google.maps.Animation.DROP,
                                        callback: function (marker) {
                                            if (marker) {
                                                $("#gmap_geocoding").gmap3({
                                                    map: {
                                                        options: {
                                                            zoom: 15,
                                                            center: results[0].geometry.location,
                                                        }
                                                    }
                                                });
                                            } else {
                                                alert('Địa Chỉ Không Hợp Lệ');
                                            }
                                        }
                                    }
                                });
                            }
                        }
                    });
                };

                $('#gmap_geocoding_btn').click(function (e) {
                    e.preventDefault();
                    handleAction();
                });

                $("#gmap_geocoding_address").keypress(function (e) {
                    var keycode = (e.keyCode ? e.keyCode : e.which);
                    if (keycode == '13') {
                        e.preventDefault();
                        handleAction();
                    }
                });

                $("#tab_1_1").on('shown.bs.tab', function () {
                    google.maps.event.trigger(map, 'resize');
                });
            };

            return {
                init: function () {
                    mapGeocoding();
                }
            };
        }();

        jQuery(document).ready(function () {
            MapsGoogle.init();
            // Handle checkbox button for every Checkbox respectively
            jQuery('.list-unstyled').on('change', 'li label .checkbox', function () {
                var checked = jQuery(this).is(":checked");
                if (checked) {
                    $(this).attr("checked", true);
                } else {
                    $(this).attr("checked", false);
                }
                $(this).parents('li').toggleClass("active");
                $(this).parents('span').toggleClass("checked");
            });
        });
    </script>

}
